package cloud.lysky.product.service.impl;

import cloud.lysky.product.service.IProductService;
import cloud.lysky.product.domain.Product;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Slf4j
@Service
public class ProductServiceImpl implements IProductService {
    @Override
    public Product getById(Long productId) {
        Product product = new Product();
        product.setId(productId);
        product.setName("Macbook Pro " + productId);
        product.setPrice(BigDecimal.valueOf(100));
        product.setNum(3);
        try {
            Thread.sleep(30000); // 模拟远程查询
        } catch (InterruptedException e) {
            log.error("Error occurred while fetching product data.", e);
        }
        return product;
    }
}
